<!doctype html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
</head>
<body>
<#--<form method="post" action="/login">-->
<table>
    <tr>
        <td>User:</td>
        <td><input type='text' name='username' value='你爸爸' id="username"></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><input type='password' name='password' value="abc" id="password"/></td>
    </tr>
    <tr>
        <td>记住我 <input type="checkbox" name="remembermeee" id="rememberMe"></td>
    </tr>
    <tr>
        <td>
            <button name="submit" id="btnLogin">提交</button>
        </td>
    </tr>
</table>
<#--</form>-->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script>

    function onLoginClick(e) {
        $.post("/login", {username: $("#username").val(), password: $("#password").val(), remembermeee:$("#rememberMe").prop("checked")}, function (data) {
            window.location.href = "/home/index";
        }).fail(function (data) {
            alert(data.getResponseHeader("message"));
        })
    };
    $(document).ready(function (e) {
        $("#btnLogin").click(onLoginClick);
    })
</script>
</body>
</html>